import Vue from 'vue'
import VueRouter from 'vue-router'
import UserList from '../components/admin/UserList.vue'
import Index from '../components/Index'
import AdminIndex from '../components/admin/AdminIndex'
import FactoryList from'../components/admin/FactoryList'
import GoodKind from '../components/admin/GoodKind'
import Good from '../components/admin/Good'
import ClientIndex from '../components/client/ClientIndex'
import FactoryIndex from '../components/factory/FactoryIndex'
import getEmail from  '../components/commom/getEmail'
import changePasword from '../components/commom/changePasword'
import AdminInfo from '../components/admin/AdminInfo'
import UserInfo from '../components/client/UserInfo'
import FactoryInfo from '../components/factory/FactoryInfo'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/Index'
  },
  {
    path: "/getEmail",
    component: getEmail
  },
  {
    path: "/changePasword",
    component: changePasword
  },
  {
    path:'/index',
    component:Index
  },{
    path: '/AdminIndex',
    component: AdminIndex,
    redirect: '/AdminInfo',
    children:[
      {path:'/UserList',component:UserList},
      {path:'/FactoryList',component:FactoryList},
      {path:'/GoodKind',component:GoodKind},
      {path:'/GoodInfo',component:Good},
      {path:'/AdminInfo',component:AdminInfo},
    ],
  },
  {
    path: '/ClientIndex',
    component: ClientIndex,
    redirect: "/UserInfo",
    children: [

      {path: "/UserInfo",component: UserInfo}
    ]
  },
  {
    path: "/FactoryIndex",
    component: FactoryIndex,
    redirect: "/FactoryInfo",
    children: [
      {path:'/FactoryInfo',component:FactoryInfo},
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
